home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
comm
/
thor
/
DMThor.lha
/
DMThor.thor
< prev
Wrap
Text File
|
1996-12-02
|
8KB
|
303 lines
/*
** Filename: DMThor.thor
**
** $VER: v1.50 (12.02.96)
**
** Author: Troy E. Bouchard
**
** Address: 737D Alyeska Ave.
** Kodiak, AK 99615
** USA
**
** EMail: tbouchar@ptialaska.net
** Webpage: http://www.ptialaska.net/~tbouchar
**
** Desc: This program will read in a conference name and copy all
** messages in that conference to a text file that you could
** then (possibly) use to create a digest and post to your
** webpage or to create a digest and post on a listserver.
** I believe that there is a Thor script that will read in
** a digest file and copy the messages to a conference of your
** choosing, I just don't remember what it's called (sorry).
** (sortmail?)
**
** Requires: Thor v2.1+ - Although this script was written with
** Thor v2.4 - it should work with versions 2.1 and up
** (not tested though)
**
*/
options results
/* Find our Thor Port and number! */
p = Address() || ' ' || show('P',,)
ThorPort = pos('THOR.',p)
if ThorPort > 0 then ThorPort = word(substr(p,ThorPort),1)
else
do
say "Can't seem to find the Thor port!"
exit 10
End
/* Load the BBSRead library up! */
if ~show('p', 'BBSREAD') then
do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
End
SIGNAL ON SYNTAX
SIGNAL ON HALT
MDF_DELETED = 5 /* Message is deleted */
MDF_UNRECOVERABLE = 6 /* Message is unrecoverable */
TB_MSGPATH = 'T:'
Call GetPages
Call Done
GetPages:
Address BBSREAD
'GETBBSLIST stem "'BBSLIST'"'
if(rc ~=0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
End
Address(ThorPort)
'REQUESTLIST instem "'BBSLIST'" outstem "'TB_SYSTEM'" title "Selection:" DRAGSELECT MULTISELECT SIZEGADGET'
if(rc ~= 0) then exit
do i=1 to TB_SYSTEM.COUNT
Address BBSREAD
'GETCONFLIST "'TB_SYSTEM.i'" CONFLIST'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
End
Address(ThorPort)
'REQUESTLIST instem "'CONFLIST'" title "Select conference on ' || TB_SYSTEM.i || ":" ||'" SIZEGADGET'
if(rc ~= 0) then TB_CONFNAME = ""
else TB_CONFNAME = result
MyConf = Translate(TB_CONFNAME,," ","_")
Address BBSREAD
'GETCONFDATA BBSName "'TB_SYSTEM.i'" ConfName "'TB_CONFNAME'" Stem CDATA'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
End
Call MessageHeader
Call TopicText
Address(ThorPort)
'OPENPROGRESS TITLE " DMThor v1.50" PT "Getting Messages..." AT "_Abort" PCW 30'
if(rc ~= 0) then
do
'REQUESTNOTIFY TEXT "'THOR.LASTERROR'" BT "_OK"'
call cleanup
end
else win = result
msgnumber = 0
do j = CDATA.FIRSTMSG to CDATA.LASTMSG
Drop MsgData.
Drop HeaderInfo.
Drop TextInfo.
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'j'" DataStem "'MsgData'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
end
if (bittst(MsgData.FLAGS,MDF_DELETED) = 0 & bittst(MsgData.FLAGS, MDF_UNRECOVERABLE) = 0) then
do
msgnumber = msgnumber + 1
Address(ThorPort)
msgtext = 'Saving Messages to: 'MyConf||'.digest'
'UPDATEPROGRESS REQ "'win'" TOTAL "'CDATA.NUMMESSAGES'" CURRENT "'msgnumber'" PT "'msgtext'"'
if(rc ~= 0) then do
call cleanup
end
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'j'" TextStem "'TextInfo'" HeadStem "'HeaderInfo'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call Cleanup
end
'AMIGA2DATE "'HeaderInfo.CREATIONDATE'" Stem "'Time'"'
if(rc ~= 0) then
do
NewTime = value('HeaderInfo.CREATIONDATETXT')
Say ''
Say 'OH NO! CREATIONDATE IS SET TO TEXT!'
Say NewTime
Say 'Delete Message nr: 'j' and try again'
call Cleanup
end
if symbol('HeaderInfo.FROMADDR') = "VAR" then
Addr = value('HeaderInfo.FROMADDR')
if symbol('HeaderInfo.FROMNAME') = "VAR" then
Nom = value('HeaderInfo.FROMNAME')
if symbol('HeaderInfo.SUBJECT') = "VAR" then
Subj = value('HeaderInfo.SUBJECT')
if symbol('HeaderInfo.TOADDR') = "VAR" then
ToAdd = value('HeaderInfo.TOADDR')
Call MessageText
end
end
end
Return
Done:
Address(ThorPort)
'REQUESTNOTIFY TEXT " We Are Done!\nDigest Files Copied!" BT "_Cool!"'
Call Cleanup
MessageHeader:
Call Open out, TB_MSGPATH || MyConf || '.digest', w
Call WriteLN out, ' '|| MyConf || ' Digest for 'Date()
Call WriteLN out, ' '
Call WriteLN out, 'Topics for Conference 'MyConf||':'
Call WriteLN out, ' '
Call Close out
Return
TopicText:
Address(ThorPort)
'OPENPROGRESS TITLE " DMThor v1.50" PT "Getting Topics..." AT "_Abort" PCW 30'
if(rc ~= 0) then
do
'REQUESTNOTIFY TEXT "'THOR.LASTERROR'" BT "_OK"'
call cleanup
end
else win = result
msgnbr = 0
do k = CDATA.FIRSTMSG to CDATA.LASTMSG
Drop HeaderInfo.
Drop MsgData.
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'k'" DataStem "'MsgData'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
end
if (bittst(MsgData.FLAGS,MDF_DELETED) = 0 & bittst(MsgData.FLAGS, MDF_UNRECOVERABLE) = 0) then
do
msgnbr = msgnbr + 1
Address(ThorPort)
msgtext = 'Saving Topics to: 'MyConf||'.digest'
'UPDATEPROGRESS REQ "'win'" TOTAL "'CDATA.NUMMESSAGES'" CURRENT "'msgnbr'" PT "'msgtext'"'
if(rc ~= 0) then do
call cleanup
end
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'k'" HeadStem "'HeaderInfo'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call Cleanup
end
'AMIGA2DATE "'HeaderInfo.CREATIONDATE'" Stem "'Time'"'
if(rc ~= 0) then
do
NewTime = value('HeaderInfo.CREATIONDATETXT')
Say ''
Say 'OH NO! CREATIONDATE IS SET TO TEXT!'
Say NewTime
Say 'Delete Message nr: 'k' and try again'
call Cleanup
end
if symbol('HeaderInfo.FROMADDR') = "VAR" then
Addr = value('HeaderInfo.FROMADDR')
if symbol('HeaderInfo.FROMNAME') = "VAR" then
Nom = value('HeaderInfo.FROMNAME')
if symbol('HeaderInfo.SUBJECT') = "VAR" then
Subj = value('HeaderInfo.SUBJECT')
Call Open out, TB_MSGPATH || MyConf || '.digest', a
Call WriteLN out, msgnbr'. 'Subj
Call WriteLN out, ' by 'Nom' ('Addr')'
Call WriteLN out, ' '
Call Close out
end
end
if (win ~= 0) & Symbol('win') = 'VAR' then do
Address(ThorPort)
'CloseProgress REQ' win
end
Return
MessageText:
Call Open out, TB_MSGPATH || MyConf || '.digest',a
Call WriteLN out, '---------------------------------------------------------------------------'
Call WriteLN out, ' Message Nr. 'msgnumber' '
Call WriteLN out, '---------------------------------------------------------------------------'
Call WriteLN out, 'From: 'Nom' ('Addr')'
Call WriteLN out, 'To: 'ToAdd
Call WriteLN out, 'Subject: 'Subj
Call WriteLN out, ' '
cnt = value('TextInfo.TEXT.COUNT')
if(cnt = 0) then call writeln(out,'No Text')
else
do
do n = 1 to cnt
call writeln(out, value('TextInfo.TEXT.n'))
end
Call Close out
end
Call Close out
Return
SYNTAX:
SAY 'Error: 'rc' in line 'sigl': 'errortext(rc)
HALT:
cleanup:
IF (win ~= 0) & SYMBOL('win') = 'VAR' THEN DO
ADDRESS(ThorPort)
'CLOSEPROGRESS REQ' win
END
EXIT